<template>
    <div id="insuresUpdate">
       <h1>修改产品</h1>
       
        <el-main>         
            <el-form  ref="ruleForm" label-width="100px" class="demo-ruleForm">
            <el-form-item label="保险名称" >
                <el-input v-model="insure.name"></el-input>
            </el-form-item>

            <el-form-item label="保险分类" >
               <!-- <el-select placeholder="请选择类型"  >
                    <el-option v-for="item in classes" :key="item._id" :value="item._id">{{item.name}}  </el-option>
                </el-select> -->
            </el-form-item>

            <el-form-item label="缴费类型" >
               <el-select placeholder="请选择类型" v-model="insure.payType" >
                    <el-option v-for="(item,index) in payType" :key="index" :value="item">{{item}}  </el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="适用人群" >
                <el-select placeholder="请选择人群" v-model="insure.suitableFor" >
                    <el-option v-for="(item,index) in suitableFor" :key="index" :value="item">{{item}}  </el-option>
                </el-select>
            </el-form-item> 

            <el-form-item label="可否续保" >
                <el-switch
                v-model="insure.renew"
                active-text="是"
                inactive-text="否">
                </el-switch>
            </el-form-item>

            <el-form-item label="保险名称" >
                    <el-radio v-model="insure.policy" label="电子保单">电子保单</el-radio>
                    <el-radio v-model="insure.policy" label="纸质保单">纸质保单</el-radio>
            </el-form-item>

            <el-form-item label="保险价格" >
                <el-input v-model="insure.price"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="updateInusres">确认修改</el-button>
                
            </el-form-item>
            </el-form>
        </el-main>
   </div>
</template>

<script>
import {createNamespacedHelpers} from "vuex"
const { mapActions, mapState } = createNamespacedHelpers("insuresUpdate");
export default {
    
    created(){
        this.getInsuresById(this.$route.params._id)
    },
    data(){
        return{
            payType:['年交','季交','月交','日交'],
            suitableFor:['3个月-6周岁','6周岁-18周岁','18周岁-60周岁','60周岁以上'],
            // renew:true,
            policy:['电子保单','纸质保单'],
            

        }
    },
    computed:{
        ...mapState(['insure'])
    },
    methods:{
        ...mapActions(['getInsuresById','updateInusres'])
    }
}
</script>

<style lang="scss">
#insuresUpdate{
    .el-form{
        width: 400px;
        margin:0 auto;
        
    }

}
</style>